package com.retail.lottery.colalottery.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.retail.lottery.colalottery.entity.NoticeTemplate;
import com.retail.lottery.colalottery.service.NoticeTemplateService;
import com.retail.lottery.colalottery.mapper.NoticeTemplateMapper;
import org.springframework.stereotype.Service;

/**
* @author jarvis.zhang
* @description 针对表【notice_template(消息模版配置表)】的数据库操作Service实现
* @createDate 2025-07-03 18:24:45
*/
@Service
public class NoticeTemplateServiceImpl extends ServiceImpl<NoticeTemplateMapper, NoticeTemplate>
    implements NoticeTemplateService{

    @Override
    public NoticeTemplate getNoticeTemplateId(String buCode, String setupId, Integer type) {
    return baseMapper.selectOne(new LambdaQueryWrapper<NoticeTemplate>()
            .eq(NoticeTemplate::getBuCode,buCode)
            .eq(NoticeTemplate::getSetupId, setupId)
            .eq(NoticeTemplate::getNoticeType, type)
            .orderByDesc(NoticeTemplate::getId)
            .last("limit 1"));
    }
}




